package xin.yangshuai.basic01.gof23.adapter;

import xin.yangshuai.basic01.gof23.adapter.impl.MyHdmiComputer;
import xin.yangshuai.basic01.gof23.adapter.impl.MyHdmiMonitor;
import xin.yangshuai.basic01.gof23.adapter.impl.MyHdmiToHdmiCable;
import xin.yangshuai.basic01.gof23.adapter.impl.MyVgaMonitor;

public class Main {

    public static void main(String[] args) {

        String showContent = "hdmi显示器可以显示内容了";
        HdmiMonitor hdmiMonitor = new MyHdmiMonitor();
        HdmiToHdmiCable hdmiToHdmiCable = new MyHdmiToHdmiCable();
        HdmiComputer hdmiComputer = new MyHdmiComputer();

        hdmiMonitor.setShowContent(showContent);
        hdmiToHdmiCable.connect(hdmiMonitor);
        hdmiComputer.connect(hdmiToHdmiCable);

        String show = hdmiComputer.show();
        System.out.println(show);

        String showInfo = "vga显示器可以显示内容了";
        VgaMonitor vgaMonitor = new MyVgaMonitor();
        HdmiToVgaAdapter hdmiToVgaAdapter = new HdmiToVgaAdapter();
        HdmiToHdmiCable hdmiToHdmiCable1 = new MyHdmiToHdmiCable();
        HdmiComputer hdmiComputer1 = new MyHdmiComputer();

        vgaMonitor.setShowInfo(showInfo);
        hdmiToVgaAdapter.connect(vgaMonitor);
        hdmiToHdmiCable1.connect(hdmiToVgaAdapter);
        hdmiComputer1.connect(hdmiToHdmiCable1);

        String show1 = hdmiComputer1.show();
        System.out.println(show1);
    }
}
